var adminUtil = {
  loadPrivilege: function (vue, userid) {
    return new Promise((resolve, reject) => {
      var params = new URLSearchParams() // 必须使用此方式进行数据传递
      params.append('userid', userid) // 设置传递参数
      vue.$axios.post('/adminApi/privileges', params) // /api/problem.action
        .then(response => {
          var data = [
            {
              index: 'user',
              title: '用户管理',
              icon: 'home',
              subItems: [
                {
                  index: '/back/admin/user/user_list',
                  title: '用户列表',
                  icon: 'th-list'
                },
                {
                  index: '/back/admin/user/group_list',
                  title: '权限管理',
                  icon: 'cubes'
                }
              ]
            },
            {
              index: '2',
              title: '项目管理',
              icon: 'globe',
              subItems: [
                {
                  index: '/back/admin/project/project_list',
                  title: '项目列表',
                  icon: 'tasks'
                },
                {
                  index: '/back/admin/project/project_comment',
                  title: '项目评论管理',
                  icon: 'comment'
                }
              ]
            },
            {
              index: '3',
              title: '新闻管理',
              icon: 'newspaper',
              subItems: [
                {
                  index: '/back/admin/news/news_add',
                  title: '创建新闻',
                  icon: 'file'
                },
                {
                  index: '/back/admin/news/news_list',
                  title: '新闻列表',
                  icon: 'book'
                }
              ]
            }
          ]
          resolve(data) // 返回处理结果
        })
        .catch((error) => {
          reject(error)
        })
    })
  }
}
export default {
  admin: adminUtil
}
